<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8"%>

<%@ include file="/core/taglibs.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
  
<head>
 	<%@ include file="/core/memberMeta.jsp"%>
 	<script src="<%=basePath%>/resources/memberCss/assets/js/jquery-1.10.2.min.js"></script>  
	<script type="text/javascript"> 
		
		$(function() {
		    $('#submit').click(function() {
		    	var checkSubmitFlg = true; 
		    	
				 
				if ($("#myTwoPassword").val() == "") {
					alert("请输入安全密码。");
				 
					checkSubmitFlg= false;
				}
		    	 
		    	if(checkSubmitFlg==true){
		    		
		    		var this_ = this;
			    	this_.setAttribute("disabled", true);  
			    	this_.value="请稍等，提交中...";  
			        $.ajax({
			            url: '<%=basePath%>/member/member/dailiSheng.shtml',
			            type: 'post',
			            dataType:'json',
			            data: $("#commitForm").serializeArray(),
			            success: function(result) {
			            	 if(result.success==true){
			            	 	 alert("恭喜您，代理商原点升级成功。");
			            		 
			            		 location.reload();//刷新页面   
			            	 }else{
			            	 	 alert("升级失败。"+result.msg);
			            	 	 location.reload();//刷新页面   
			            	 }
			            	 
			            	 //放到回调里
			            	 this_.removeAttribute("disabled"); 
			        		 this_.value="提  交";  
			            }
			        });
			        
			        
            	 	 
		    	}
		    	
		    });
		});
	</script>
</head>

<!-- 防止重复提交 -->
<script type="text/javascript">
	var checkSubmitFlg = false;
	function checkSubmit() {
		if (checkSubmitFlg == true) {
			return false;
		}
		checkSubmitFlg = true;
		return true;
	}
	document.ondblclick = function docondblclick() {
		window.event.returnValue = false;
	}
	document.onclick = function doconclick() {
		if (checkSubmitFlg) {
			window.event.returnValue = false;
		}
	}
</script>

<script type="text/javascript">

<%-- function product(){
	var dailiId=$("#dailiId").val(); 		
	$.getJSON("<%=basePath%>/member/product/ajaxGetProductByDailiId.shtml",{dailiId: $("#dailiId").val()},function(result){
		
		$("#productId option").not(":first").remove(); 
        $.each(result.productList,function(i,n){
		 	$("#productId").append("<option value='"+n.id+"'>"+n.title+"</option>");
		});
		selRefresh("productId");
	});
}; --%>
function product(){
	var dailiId=$("#dailiId").val(); 		
	 
	$.getJSON("<%=basePath%>/member/product/ajaxGetProductByDailiId.shtml",{dailiId: $("#dailiId").val()},function(result){
		if(dailiId==0){
			$("#productId option").not(":first").remove(); 
		}else{
		$("#productId option").not(":first").remove(); 
	        $.each(result.productList,function(i,n){
			 	$("#productId").append("<option value='"+n.id+"'>"+n.title+"</option>");
			}); 
		} 
	});
};

function content(){
	var productId=$("#productId").val(); 	
	$.getJSON("<%=basePath%>/member/product/ajaxGetContent.shtml", {productId : productId}, function(result) {
		$("#content").html("<b  style='color: blue;'>套餐详情："+result.content+"套餐价格："+result.price+"</b>");
	});
}

</script>

<body>
	<script src="<%=basePath%>/resources/memberCss2/assets/js/theme.js"></script>
	<div class="page-heading">
		<h3>账号管理</h3>
		<ul class="breadcrumb">
			<li>账号管理</li>
			<li class="active">原点升级</li>
		</ul>
	</div>
	<section class="wrapper">
		<div class="row">
			<div class="col-lg-12">
				<section class="panel">
					<header class="panel-heading">原点升级 </header>
					<div class="panel-body">
					
					  <form  name="commitForm" id="commitForm" class="form-horizontal adminex-form" action="<%=basePath%>/member/member/dailiSheng.shtml" method="post" onsubmit="return checkSubmit();">
							<jodd:form scopes="request" beans="member">
							<input type="hidden" name="token" value="${token}" />

								<div class="form-group">
									<label class="col-sm-2 col-sm-2 control-label">代理商账号:</label>
									<div class="col-sm-10">
										${member.loginName}
									</div>
								</div>

								<div class="form-group">
									<label class="col-sm-2 col-sm-2 control-label">投资额：</label>
									<div class="col-sm-10">
										 ${member.title}（投资额：${member.payNum}）
									</div>
								</div>
								
								<div class="form-group">
									<label class="col-sm-2 col-sm-2 control-label">代理商级别</label>
									<div class="col-sm-10">
										<select type="select" class="form-control m-bot15" id="dailiId" name="dailiId" onchange="product()">
											<option value="">请选择代理商级别</option>
											<c:forEach items="${dailiList}" var="o">
												<option value="${o.id}">${o.title}(${o.payNum})</option>
											</c:forEach>
										</select>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 col-sm-2 control-label">产品套餐</label>
									<div class="col-sm-10">
										<select class="form-control form-cascade-control" id="productId" name="productId" onchange="content()">
												<option value="">请选择套餐</option>
										</select>
										<span id="content" style="color: blue;"></span>
									</div>
								</div>


								<div class="form-group">
									<label class="col-sm-2 col-sm-2 control-label">我的购物积分：</label>
									<div class="col-sm-10">
										 ${member.ele}
									</div>
								</div>

								<div class="form-group">
									<label class="col-sm-2 col-sm-2 control-label">安全密码：</label>
									<div class="col-sm-10">
										<input type="password" id="myTwoPassword" name="myTwoPassword" class="form-control m-bot15" />
								</div>


								<div class="form-group text-center">
									<button class="btn btn-primary" type="submit" style="width: 90px;font-size: 17px;font-weight: bold;">确定</button>
								</div>


								
								
								<div class="form-group text-center">
									<div style="color: red; text-align: center;">${retMsg}</div>
								</div>
							</jodd:form>
						</form>
					</div>
				</section>
			</div>
		</div>
	</section>
	<script src="<%=basePath%>/resources/memberCss2/assets/js/amazeui2.min.js"></script>
	<script src="<%=basePath%>/resources/memberCss2/assets/js/amazeui.datatables.min.js"></script>
	<script src="<%=basePath%>/resources/memberCss2/assets/js/dataTables.responsive.min.js"></script>
	<script src="<%=basePath%>/resources/memberCss2/assets/js/app.js"></script>
	
	<!--代码高亮end-->
	<c:if test="${result}">
		<script language="JavaScript" type="text/javascript">
			alert('${retMsg}');
		</script>
	 </c:if>
	
</body>

</html>
